package com.chancein.cloud.ocr.process.util;

import com.chancein.cloud.ocr.process.exception.CloneException;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.List;

/**
 * 注释
 *
 * @author: LiaoZiHao
 * @date: 2023/8/10 9:31
 * Copyright © 2022 Hundsun Technologies Inc. All Rights Reserved
 */
public class CloneUtils {
    public static List cloneList(List list) {
        List cloneList = null;

        try {
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            ObjectOutputStream obs = new ObjectOutputStream(out);
            obs.writeObject(list);
            obs.close();
            ByteArrayInputStream ios = new ByteArrayInputStream(out.toByteArray());
            ObjectInputStream ois = new ObjectInputStream(ios);
            cloneList = (List)ois.readObject();
            ois.close();
            return cloneList;
        } catch (Exception var6) {
            throw new CloneException(var6);
        }
    }
}
